--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--[[

    *开启【多多益善】后，胡桃的四个aoe（蝶引来生、安魂仪式、安魂秘法、焚身蝶火）会影响范围内的梅花、没花和煤花，使其立刻转变为莓花。
    蝶引来生 butterfly_s_embrace
    安魂仪式 requiem_ceremony
    安魂秘法 seal_of_mystery
    焚身蝶火 blazing_butterfly

    inst:PushEvent("hutao_event.spell_finish_for_plum_blossom",{
        pt = Vector3(x,y,z),
        radius = SPELL_START_AOE_RADIUS,
        spell = "butterfly_s_embrace",
    })
        
]]--
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
---
    local function spell_end_event(inst,_table)
        if not (inst.components.hutao_com_talent_tree:IsUnlocked("the_more_the_better") or TUNING.HUTAO_DEBUGGING_MODE )then
            return
        end
        local pt = _table and _table.pt or {}
        local radius = _table and _table.radius
        if not (pt.x and pt.y and pt.z and radius) then
            return
        end
        local target_tags = {
            "hutao_tag.plum_blossom",
            "hutao_tag.berry_flower",
            "hutao_tag.coal_flower",
            "hutao_tag.no_flower",
        }
        local flowers = TheSim:FindEntities(pt.x,0,pt.z,radius,nil,nil,target_tags)
        for i,v in ipairs(flowers) do
            local x,y,z = v.Transform:GetWorldPosition()
            v:Remove()
            SpawnPrefab("hutao_plant_berry_flower").Transform:SetPosition(x,y,z)
            SpawnPrefab("hutao_sfx_pink_flame"):PushEvent("Set",{pt = Vector3(x,y,z)})
        end
    end
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

return function(inst)
    if not TheWorld.ismastersim then
        return
    end

    inst:ListenForEvent("hutao_event.spell_finish_for_plum_blossom",spell_end_event)
end